//
//  ESUNRefreshView.h
//  TEST
//
//  Created by wang yongfeng on 14-3-20.
//  Copyright (c) 2014年 wang yongfeng. All rights reserved.
//
#define dESRefreshViewHeight  64.0
#define dESRefreshAnimationDuration  0.25

#define dESRefreshFooterNormal   @"上拉加载更多"
#define dESRefreshFooterPull     @"松开加载更多"
#define dESRefreshFooterRefresh  @"正在加载更多"

#define dESRefreshHeaderNormal   @"下拉可以刷新"
#define dESRefreshHeaderPull     @"松开立即刷新"
#define dESRefreshHeaderRefresh  @"正在进行刷新"

#define dESRefreshContentOffset  @"contentOffset"
#define dESRefreshContentSize    @"contentSize"
#define dESRefreshContentColor   [UIColor colorWithRed:157/255.0 green:157/255.0 blue:157/255.0 alpha:1]
#define dESRefreshContentFont    @"FONT_NAME"

typedef enum {
    eESRefreshStateNormal,  //拉动刷新
    eESRefreshStatePull,    //松开刷新
    eESRefreshStateRefresh  //正在刷新
}ESUNRefreshState;

@class ESUNRefreshView;
@protocol ESUNRefreshDelegate <NSObject>

- (void)refreshViewBeginRefresh:(ESUNRefreshView *)refreshView;
- (void)refreshViewEndRefresh:(ESUNRefreshView *)refreshView;
- (void)refreshView:(ESUNRefreshView *)refreshView stateChanged:(ESUNRefreshState)state;
@end

#import <UIKit/UIKit.h>

@interface ESUNRefreshView : UIView
{
    __weak UIScrollView *_scrollView;
    ESUNRefreshState _state;
}
@property(strong,nonatomic)UILabel *stateLable;//状态说明
@property(strong,nonatomic)UIActivityIndicatorView *indicator;//指示器
@property(weak,nonatomic) UIScrollView *scrollView; //添加到的父类view;
@property(assign,nonatomic)id<ESUNRefreshDelegate> delegate;
@property(nonatomic,readonly,getter = isRefreshing)BOOL refreshing;//是否正在刷新
@property(nonatomic,assign)BOOL canRefresh;
//开始刷新
- (void)beginRefreshing;
//结束刷新
- (void)endRefreshing;
//设置刷新状态
- (void)setRefreshState:(ESUNRefreshState)state;
//释放
- (void)free;
@end


